//
//  UIBarButtonItem+Extension.swift
//  WeiBoPro
//
//  Created by hejinhui on 2018/5/6.
//  Copyright © 2018年 hjh. All rights reserved.
//

import Foundation
import UIKit
/**
 创建UIBarButtonItem的分类
 */
extension UIBarButtonItem
{
    convenience init(title:String,fontSize:CGFloat = 16,target:Any?,action:Selector,isBack: Bool = false) {
        let btn = UIButton()
        if isBack {
            btn.setImage(UIImage(named: "navigationbar_back"), for: .normal)
        }
        btn.setTitle(title, for: .normal)
        btn.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        btn.setTitleColor(UIColor.gray, for: .normal)
        btn.setTitleColor(UIColor.orange, for: .highlighted)
        btn.addTarget(target, action: action, for: .touchUpInside)
        self.init(customView: btn)
    }
    
}
